<?php
$this->breadcrumbs=array(
	'考试'=>array('index'),
	$model->exams_name,
);

$this->menu=array(
	array('label'=>'提交', 'url'=>array('index','state'=>'1')),
	array('label'=>'保存', 'url'=>array('index','state'=>'1')),
	array('label'=>'返回', 'url'=>array('index')),
);
?>
<h1>《<?php echo $model->tests->tests_name;?>》</h1>
(总分：<?php echo $model->tests->tests_score;?>；时长：<?php echo $model->exams_times;?>；考试组织者：<?php echo $model->author->user_name;?>；出卷者：<?php echo $model->tests->author->user_name;?>；)<br />
考试说明：<?php echo $model->exams_memo;?>
<?php 
echo CHtml::beginForm();

echo CHtml::hiddenField('checks_create_time',date("Y-m-d H:i:s"));
//$tqModel = TestsQuestion::model()->with(array('TID'=>array('condition'=>'tests_question_tid='.$model->tests->tests_id)))->findAll();
//获取大题信息
$sModel = $model->tests->subjects;
if($sModel)
{
	foreach ($sModel as $v){
	echo '<br /><br /><hr><br />';
?>
<h2><?php echo $v->subjects_title;?></h2>
<?php echo $v->subjects_memo;?>
<?php $qModel = $v->testsquestion;?>
<?php foreach($qModel as $q): ?>
<br /><br /><hr><br />
<h3><?php echo $q->tests_question_title;?></h3>
<?php echo '(占分比：'.$q->tests_question_score.'%)<br />';?>
<?php 
//给考卷匹配答案
if(is_array($rs))
{
	pecho($rs);
	if(!$rs[$q->tests_question_id])
	{
		$q->answer = '';
	}else{
		if($q->tests_question_type == 1 || $q->tests_question_type == 4)
		{
			$q->answer = $rs["$q->tests_question_id"];
		}else
		{
			$q->answer = explode("#,",$rs[$q->tests_question_id]);
		}
		
	}
}

echo CommonApp::echoTest($q,"[$q->tests_question_id]answer",$q->tests_question_type,$q->tests_question_content); ?>
<?php endforeach; ?>


<?php
	}
}
echo '<p /><center>'.CHtml::submitButton('提交').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.CHtml::submitButton('保存').'</center>'; 
echo CHtml::endForm();
?>
